The invention relates generally to a method and system for translating data between a hierarchical data structure and a generally tabular data structure for storage in a relational database.
A data processing system, such as a server, may be connected to a communications network, such as the Internet. The data processing system may communicate with another data processing system coupled to the communications network by using an open, dynamically-defined data structure such as Extensible Mark-up Language (XML). XML refers to a data structure or convention for organizing structured data within hierarchical textual file.
XML provides a set of rules and guidelines that promote the exchange of data between data processing systems regardless of platform differences or other local variations in the underlying data processing systems. XML is a subset of the International Standards Organization (ISO) Standard, Generalized, Mark-up Language (SGML), which is simplified for operation over the Internet. Both SGML and XML provide a standard document format language that enables a publisher to establish a standard document that can be exchanged, viewed, displayed, or printed in an assortment of different ways.
Although XML supports interoperability between different data processing systems, XML documents are generally difficult to query for information if the XML documents are stored in a database. A group of objects within a database or file (e.g., XML document) may be related in a defined manner. Accordingly, new objects can be created or added to the database in an expedited manner because the new objects can be derivatively defined from the existing objects. For example, one object can inherit characteristics from another object within the database. Restricted actions are applicable to particular types of objects, which may contain data responsive to a query. The foregoing inter-relationships between objects in the database and functional restrictions applicable to objects can make searching and retrieval of hierarchical documents in a database complex, cumbersome, and protracted.
To improve the data retrieval performance of databases, some software designers have developed specialized mapping architectures to allow XML documents to be mapped into a relational database for limited applications. However, the specialized mapping architecture is cumbersome because the architecture is usually based on custom database translation tables that are specific to a particular customized XML format, rather than the general XML standard. To a large extent the specificity of the custom database tables defeats the purpose of using an open, dynamically defined data structure, such as XML, in the first place. Thus, a need exists for a general or universally applicable procedure for preparing hierarchical textual file (e.g., XML document) for storage in a relational database.
In accordance with the invention, a method and system for translating data between a hierarchical data structure and a generally tabular data structure facilitates storing data representative of the hierarchical data structure in a relational database. If the hierarchical textual file is translated into a generally tabular data structure for storage in the relational database, a user may apply readily available commands for querying and manipulating the data in the relational database. If the data is translated into a hierarchical data format from the generally tabular structure in relational database, the hierarchical data may be transmitted over a communications system in a robust manner where the relational database acts as a backup repository of the transmitted data. A generally tabular data format contains data attribute fields and data element fields. A hierarchical textual file is accepted containing structured data elements. Data attributes are determined for each structured data element. The determined data attributes for corresponding data elements are stored in the generally tabular structure of the relational database in accordance with the data element fields and data attribute fields.